<template>
  <div class="pic-box">
    <img :src="src" @error="nonePic = true" @load="nonePic = false" alt="">
    <span v-show="nonePic" class="none-pic-hint">图片不存在</span>
  </div>
</template>
<script>
export default {
  data() {
    return {
      nonePic: false
    };
  },
  props: ['src'],
  methods: {
    
  },
  async mounted() {
    
  },
  destroyed() {
    
  },
};
</script>

<style lang="less" scoped>
.pic-box{
  position: relative;
  width: 100%;
  height: 100%;
  img{
    // display: block;
    // width: 100%;
    // height: auto;
    display: block;
    max-width: 100%;
    max-height: 100%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
  }
}
.none-pic-hint{
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -12px;
  line-height: 24px;
  text-align: center;
  color: #FFF;
  width: 100%;
}
</style>
